'use strict'

class  cart{
  
  constructor () {

  }
  //得到购物车列表
  async list (c) {
    console.log(c.query)
    let wuser = c.service.model.like
    let ulist = await wuser.get(c.query.userid,c.query.sayid)
    c.send(ulist)
  }

  //添加购物车
  async post (c) {
    let data=JSON.parse(c.body)
    let wuser = c.service.model.like
    await wuser.insert(data)
  }

  async put(c){
      let id=c.param.id
      let data=JSON.parse(c.body)
      let wuser=c.service.model.like
      await wuser.update(data,id)
  }

}

module.exports = cart